'use strict'

function isType (arg) {
  return Object.prototype.toString.call(arg).slice(8, -1).toLowerCase()
}

function isEmpty (arg) {
  if (arg === undefined) return true
  else if (arg === null) return true
  else if (typeof arg === 'number' && isNaN(arg)) return true
  else if (typeof arg === 'string' && 0 === arg.length) return true
  else if (Array.isArray(arg) && 0 === arg.length) return true
  else if (isType(arg) === 'object' && 0 === Object.keys(arg).length) return true
  return false
}

export {
  isType,
  isEmpty
}
